# -*- coding: utf-8 -*-
#!/usr/bin/python3

from http.server import HTTPServer
from requestHandler import requestHandler
import os.path as path

settings = {
    'address': '127.0.0.1',
    'port': 8089
}

# isFirst = False
# if not path.exists(settings['dbName']):
#     isFirst = True

print('begin')
httpd = HTTPServer((settings['address'], settings['port']), requestHandler)  # 每次请求都会创建一个requestHandler对象
try:
    httpd.serve_forever()
    print('ok')
except KeyboardInterrupt:  # ctrl + c退出
    print('Keyboard interrupt received, exiting.')
except:
    print('error')